home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
mcomm557.zip
/
ZCMPLR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-09-11
|
10KB
|
262 lines
/*/////////////////////////////////////////////////////////////////////
// //
// //
// ZCMPLR.C -- compiler specific functions //
// //
// (c) 1991, Mike Dumdei, 6 Holly Lane, Texarkana TX, 75503 //
// //
//////////////////////////////////////////////////////////////////// */
#ifndef __TURBOC__ /* defined by Turbo C compiler */
#ifndef __ZTC__ /* defined by Zortech C compiler */
#define __MSC__ /* assume Microsoft C if not TC or ZTC */
#endif
#endif
/*/////////////////////////////////////////////////////////////////
// //
// //
// Microsoft C / Quick C //
// //
// //
//////////////////////////////////////////////////////////////// */
#ifdef __MSC__
#include <dos.h>
/*/////////////////////////////////////////////////////////
// DosFindFirst -- find file (1st instance) //
//////////////////////////////////////////////////:disk:/*/
int DosFindFirst(char *pathname, int atrib, struct find_t *fstruc)
{
return (_dos_findfirst(pathname, atrib, fstruc));
}
/*/////////////////////////////////////////////////////////
// DosFindNext -- find file (except 1st instance) //
//////////////////////////////////////////////////:disk:/*/
int DosFindNext(struct find_t *fstruc)
{
return (_dos_findnext(fstruc));
}
/*/////////////////////////////////////////////////////////
// DosGetDiskFree -- gets free space left on disk //
//////////////////////////////////////////////////:disk:/*/
long DosGetDiskFree(int drive)
{
struct diskfree_t spc;
_dos_getdiskfree(drive, &spc);
return ((long)spc.avail_clusters * (long)spc.sectors_per_cluster *
(long)spc.bytes_per_sector);
}
/*/////////////////////////////////////////////////////////
// DosSetFileTime -- set file date/time //
//////////////////////////////////////////////////:disk:/*/
int DosSetFileTime(int handle, unsigned date, unsigned time)
{
return (_dos_setftime(handle, date, time));
}
/*/////////////////////////////////////////////////////////
// DosSetFileAttr -- set file attribute //
//////////////////////////////////////////////////:disk:/*/
int DosSetFileAttr(char *path, unsigned attrib)
{
return (_dos_setfileattr(path, attrib));
}
#endif
/*/////////////////////////////////////////////////////////////////
// //
// //
// Turbo C / Turbo C++ //
// //
// //
//////////////////////////////////////////////////////////////// */
#ifdef __TURBOC__
#include <dos.h>
#include <dir.h>
#include <io.h>
#if __TURBOC__ >= 0x0410
#include <bios.h>
#else
/*/////////////////////////////////////////////////////////
// _bios_keybrd -- link to Turbo C/C++ bios key //
/////////////////////////////////////////////////////////*/
int _bios_keybrd(int flag)
{
return bioskey(flag);
}
#endif
/*/////////////////////////////////////////////////////////
// DosFindFirst -- find file (1st instance) //
//////////////////////////////////////////////////:disk:/*/
int DosFindFirst(char *pathname, int atrib, struct ffblk *fstruc)
{
return (findfirst(pathname, fstruc, atrib));
}
/*/////////////////////////////////////////////////////////
// DosFindNext -- find file (except 1st instance) //
//////////////////////////////////////////////////:disk:/*/
int DosFindNext(struct ffblk *fstruc)
{
return (findnext(fstruc));
}
/*/////////////////////////////////////////////////////////
// DosGetDiskFree -- gets free space left on disk //
//////////////////////////////////////////////////:disk:/*/
long DosGetDiskFree(int drive)
{
struct dfree spc;
getdfree(drive, &spc);
return ((long)spc.df_avail * (long)spc.df_sclus * (long)spc.df_bsec);
}
/*/////////////////////////////////////////////////////////
// DosSetFileTime -- set file date/time //
//////////////////////////////////////////////////:disk:/*/
int DosSetFileTime(int handle, unsigned date, unsigned time)
{
unsigned long ftim = ((unsigned long)date << 16) | (unsigned long)time;
return (setftime(handle, (struct ftime *)&ftim));
}
/*/////////////////////////////////////////////////////////
// DosSetFileAttr -- set file attribute //
// //
// Older versions of TURBO C libraries (TC++ 1.00 for //
// sure) do not have the _dos_setfileattr function so //
// the call to it is #if'd out. The defined version //
// (0x0400) corresponds to BC++ 3.0 which does have the //
// _dos_setfileattr function. Probably some versions //
// earlier than 4.0 do too but didn't have them to find //
// out. It is only used if an undocumented switch is //
// enabled so you probably will never miss it. //
//////////////////////////////////////////////////:disk:/*/
int DosSetFileAttr(char *path, unsigned attrib)
{
#if __TURBOC__ >= 0x0400
return (_dos_setfileattr(path, attrib));
#else
return 0;
#endif
}
#endif
/*/////////////////////////////////////////////////////////////////
// //
// //
// Zortech C / Zortech C++ //
// //
// //
//////////////////////////////////////////////////////////////// */
#ifdef __ZTC__
#define MSDOS 1
#include <dos.h>
long timezone = 0L;
/*/////////////////////////////////////////////////////////
// DosFindFirst -- find file (1st instance) //
//////////////////////////////////////////////////:disk: */
int DosFindFirst(char *pathname, int atrib, struct find_t *fstruc)
{
return (_dos_findfirst(pathname, atrib, fstruc));
}
/*/////////////////////////////////////////////////////////
// DosFindNext -- find file (except 1st instance) //
//////////////////////////////////////////////////:disk: */
int DosFindNext(struct find_t *fstruc)
{
return (_dos_findnext(fstruc));
}
/*/////////////////////////////////////////////////////////
// DosGetDiskFree -- gets free space left on disk //
//////////////////////////////////////////////////:disk: */
long DosGetDiskFree(int drive)
{
return (dos_getdiskfreespace(drive));
}
/*/////////////////////////////////////////////////////////
// DosSetFileTime -- set file date/time //
//////////////////////////////////////////////////:disk: */
int DosSetFileTime(int handle, unsigned date, unsigned time)
{
return (dos_setftime(handle, date, time));
}
/*/////////////////////////////////////////////////////////
// DosSetFileAttr -- set file attribute //
//////////////////////////////////////////////////:disk: */
int DosSetFileAttr(char *path, unsigned attrib)
{
return (dos_setfileattr(path, attrib));
}
#endif
/*/////////////////////////////////////////////////////////////////////
// //
// The following math functions were added in TXZM version 2.15 in